<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;

class PaymentsController extends Controller
{
    public function pay(Request $request)
    {
        // 支付宝支付
        $payinfo = [
            'out_trade_no' => '',
            'total_amount' => 1,
            'subject' => '支付宝测试订单'
        ];

        // 微信支付
        if ($request->pay_type == 'wechat_pay') {
            $payinfo = [
                'out_trade_no' => '',
                'total_fee' => 1 * 100,
                'body' => '微信测试订单',
            ];
        }

        return app($request->pay_type)->app($payinfo);
    }
}
